<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>场地管理</title>
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<link rel="stylesheet" href="css/membership.css">
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/bossIndex.css">
	<link rel="stylesheet" href="css/flexible.css">
	<link rel="stylesheet" href="css/vant.css">
	<script src="js/vue/vue.js"></script>
	<script src="js/vue/axios.js"></script>
	<script src="js/vue/vant.js"></script>
	<script src="js/glabe.js"></script>
	<script src="js/jquery.md5.js"></script>
	<script src="js/vue/qs.js"></script>
	<script src="js/jquery-3.3.1.min.js"></script>
	<script src="js/fontsize.js"></script>
</head>
<body>
<div class="container_box" id="app"id="app">
	<div class="add_jl">
		<a href="addSite.html">
			<img src="images/addcomments.png">
		</a>
	</div>
	<div class="group_details group_details_state clearfix margintop" v-for="item in dataList" :key="item.id" @click="editSite(item.id)">
		<div class="spinning_txt fl" style="width:100%;">
			<p class="margin_bottom">
				<span class="fontsize16">{{item.Space_name}}</span>
				<!-- <span class="spinning_txx fontsize16"></span> -->
			</p>
			<p style="margin-bottom: 0.1rem;">
				<span class="spinning_name fontsize14">可容纳{{item.Num}}人</span>
				<span class="font_size12 rf">
					<span class="notUse fontsize14" v-if="item.State==0" @Click="disableSite(item.id)">停用</span>
					<span class="modify fontsize14" v-if="item.State==1" @Click="disableSite(item.id)">启用</span>
				</span>
			</p>
		</div>
	</div>
</div>
<script>
var app = new Vue({
    el: '#app',
    data: {
			dataList:[],  //场地列表
    },
    created() {
		this.getList();
    },
    methods: {
		//获取列表接口
		getList(){
			axios.get('mobileapi/boss/space.php?act=list',).then(res=>{
				if (res.data.code == 200) {
					var dataList=res.data.data;
					this.dataList=dataList;
				}else{
					vant.Toast(res.data.msg);
				}
			}).catch(err=>{
					vant.Toast('请求发送失败，请重试');
			});
		},
		//启用场地接口(停用按钮))
		disableSite(id){

			axios.get('mobileapi/boss/space.php?act=update&id='+id).then(res=>{
				if (res.data.code == 200) {
					vant.Toast('场地状态修改成功');
					this.getList();
				}else{
					vant.Toast(res.data.msg);
				}
			});
			event.stopPropagation();
		},
		//修改场地信息
		editSite(id){
			location.href="addSite.html?id="+id;
		}
    }
})
</script>
</body>
</html>